/*************************************************************************
 *                     COPYRIGHT NOTICE
 *            Copyright 2024 Horizon Robotics, Inc.
 *                   All rights reserved.
 *************************************************************************/
#ifndef GLES_DEBUG_HPP
#define GLES_DEBUG_HPP

#include <stdio.h>
#include <GLES3/gl32.h>
#include <EGL/egl.h>

#define CHECK(x)										\
	do											\
	{											\
		if (!(x))									\
		{										\
			printf("[ERROR] %s:%d (%s) not satisfied\n", __FILE__, __LINE__, #x);	\
		}										\
	} while (0)
#define ASSERT_TRUE_WITH_RETURN_VAL(x, val)							\
	do											\
	{											\
		if (!(x))									\
		{										\
			printf("[ERROR] %s:%d (%s) not satisfied\n", __FILE__, __LINE__, #x);	\
			return val;								\
		}										\
	} while (0)

void eglCheckError_(const char *file, int line);
#define eglCheckError() eglCheckError_(__FILE__, __LINE__)

void glDebugContexOutput(GLenum source, 
                	 GLenum type,
			 unsigned int id,
			 GLenum severity,
			 GLsizei length,
			 const char *glmessage,
			 const void *userParam);

#endif